	.file	"myspinlock.c"
	.comm	lock,4,4
	.globl	tickets
	.data
	.align 4
	.type	tickets, @object
	.size	tickets, 4
tickets:
	.long	3
	.text
	.globl	myspin_lock
	.type	myspin_lock, @function
myspin_lock:
.LFB2:
	.cfi_startproc
	pushl	%ebp
	.cfi_def_cfa_offset 8
	.cfi_offset 5, -8
	movl	%esp, %ebp
	.cfi_def_cfa_register 5
	movl	8(%ebp), %edx
#APP
# 9 "myspinlock.c" 1
	1:
	movl $1, %eax
	xchg %eax, (%edx)
	test %eax, %eax
	jnz 1b
# 0 "" 2
#NO_APP
	popl	%ebp
	.cfi_restore 5
	.cfi_def_cfa 4, 4
	ret
	.cfi_endproc
.LFE2:
	.size	myspin_lock, .-myspin_lock
	.globl	myspin_unlock
	.type	myspin_unlock, @function
myspin_unlock:
.LFB3:
	.cfi_startproc
	pushl	%ebp
	.cfi_def_cfa_offset 8
	.cfi_offset 5, -8
	movl	%esp, %ebp
	.cfi_def_cfa_register 5
	movl	8(%ebp), %eax
#APP
# 20 "myspinlock.c" 1
	movl $1, (%eax)
# 0 "" 2
#NO_APP
	popl	%ebp
	.cfi_restore 5
	.cfi_def_cfa 4, 4
	ret
	.cfi_endproc
.LFE3:
	.size	myspin_unlock, .-myspin_unlock
	.section	.rodata
.LC0:
	.string	"allen buy a ticket"
	.text
	.globl	allen
	.type	allen, @function
allen:
.LFB4:
	.cfi_startproc
	pushl	%ebp
	.cfi_def_cfa_offset 8
	.cfi_offset 5, -8
	movl	%esp, %ebp
	.cfi_def_cfa_register 5
	subl	$40, %esp
	movl	$1, -16(%ebp)
	jmp	.L4
.L7:
	movl	$lock, (%esp)
	call	myspin_lock
	movl	tickets, %eax
	movl	%eax, -12(%ebp)
	movl	$20000, (%esp)
	call	usleep
	cmpl	$0, -12(%ebp)
	jle	.L5
	movl	$.LC0, (%esp)
	call	puts
	subl	$1, -12(%ebp)
	movl	$20000, (%esp)
	call	usleep
	movl	-12(%ebp), %eax
	movl	%eax, tickets
	jmp	.L6
.L5:
	movl	$0, -16(%ebp)
.L6:
	movl	$lock, (%esp)
	call	myspin_unlock
	movl	$20000, (%esp)
	call	usleep
.L4:
	cmpl	$0, -16(%ebp)
	jne	.L7
	movl	$0, %eax
	leave
	.cfi_restore 5
	.cfi_def_cfa 4, 4
	ret
	.cfi_endproc
.LFE4:
	.size	allen, .-allen
	.section	.rodata
.LC1:
	.string	"luffy buy a ticket"
	.text
	.globl	luffy
	.type	luffy, @function
luffy:
.LFB5:
	.cfi_startproc
	pushl	%ebp
	.cfi_def_cfa_offset 8
	.cfi_offset 5, -8
	movl	%esp, %ebp
	.cfi_def_cfa_register 5
	subl	$40, %esp
	movl	$1, -16(%ebp)
	jmp	.L10
.L13:
	movl	$lock, (%esp)
	call	myspin_lock
	movl	tickets, %eax
	movl	%eax, -12(%ebp)
	movl	$20000, (%esp)
	call	usleep
	cmpl	$0, -12(%ebp)
	jle	.L11
	movl	$.LC1, (%esp)
	call	puts
	subl	$1, -12(%ebp)
	movl	$20000, (%esp)
	call	usleep
	movl	-12(%ebp), %eax
	movl	%eax, tickets
	jmp	.L12
.L11:
	movl	$0, -16(%ebp)
.L12:
	movl	$lock, (%esp)
	call	myspin_unlock
	movl	$20000, (%esp)
	call	usleep
.L10:
	cmpl	$0, -16(%ebp)
	jne	.L13
	movl	$0, %eax
	leave
	.cfi_restore 5
	.cfi_def_cfa 4, 4
	ret
	.cfi_endproc
.LFE5:
	.size	luffy, .-luffy
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	pushl	%ebp
	.cfi_def_cfa_offset 8
	.cfi_offset 5, -8
	movl	%esp, %ebp
	.cfi_def_cfa_register 5
	andl	$-16, %esp
	subl	$32, %esp
	movl	$0, 12(%esp)
	movl	$allen, 8(%esp)
	movl	$0, 4(%esp)
	leal	24(%esp), %eax
	movl	%eax, (%esp)
	call	pthread_create
	movl	$0, 12(%esp)
	movl	$luffy, 8(%esp)
	movl	$0, 4(%esp)
	leal	28(%esp), %eax
	movl	%eax, (%esp)
	call	pthread_create
	movl	24(%esp), %eax
	movl	$0, 4(%esp)
	movl	%eax, (%esp)
	call	pthread_join
	movl	28(%esp), %eax
	movl	$0, 4(%esp)
	movl	%eax, (%esp)
	call	pthread_join
	movl	$0, %eax
	leave
	.cfi_restore 5
	.cfi_def_cfa 4, 4
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 4.8.2-19ubuntu1) 4.8.2"
	.section	.note.GNU-stack,"",@progbits
